<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.io.* "%>
<%@ page import="jakarta.servlet.*" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
	String repair_id=request.getParameter("id");//取得传递过来的用户参数，用于查询和删除
	System.out.println(repair_id);
	Connection conn=null;
	try{
		Class.forName("org.h2.Driver");//加载驱动
	} catch (ClassNotFoundException e) {
		e.printStackTrace();
		return;
	}
	try {
		conn = DriverManager.getConnection("jdbc:h2:d:/CompanyCar/temp/mydbtest", "sa", "");
		String sql="update car_repair set transport_department_person=?,repair_status=? where repair_id='"+repair_id+"'";
		PreparedStatement pstmt  = conn.prepareStatement(sql);
		pstmt.setString(1,request.getParameter("transport_department_person"));
    	pstmt.setString(2,"已维修");
		System.out.println(sql);
		//执行数据库插入，获取结果集
		int result=pstmt.executeUpdate();
		System.out.println(result);
		//关闭表达式对象
		pstmt.close();			
		//关闭数据库				
		conn.close();
	} catch (SQLException e) {
		e.printStackTrace();
	} finally{
	//防止数据库未正常关闭
	try{
		if (conn!=null && (!conn.isClosed())){
			conn.close();
		}
	}catch(SQLException e){
		e.printStackTrace();
	}
}
	response.sendRedirect("D-Details_repair.jsp");
%>


</body>
</html>